From cc4acfadcd71ee07c8d1b29411620a79451780b9 Mon Sep 17 00:00:00 2001
From: Joan Bruguera <joanbrugueram@gmail.com>
Date: Wed, 13 Apr 2022 21:21:13 +0200
Subject: [PATCH] Buildfix NVIDIA 470.129.06 for Linux 5.19-rc1

---
 nvidia-drm/nvidia-dma-resv-helper.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/nvidia-drm/nvidia-dma-resv-helper.h b/nvidia-drm/nvidia-dma-resv-helper.h
index ad8800d..65ea1f8 100644
--- a/nvidia-drm/nvidia-dma-resv-helper.h
+++ b/nvidia-drm/nvidia-dma-resv-helper.h
@@ -39,6 +39,15 @@
 #include <linux/reservation.h>
 #endif
 
+#include <linux/version.h>
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 0))
+// Rel. commit "dma-buf: specify usage while adding fences to dma_resv obj v7" (Christian König, 9 Nov 2021)
+static inline void dma_resv_add_excl_fence(struct dma_resv *obj, struct dma_fence *fence)
+{
+    dma_resv_add_fence(obj, fence, DMA_RESV_USAGE_WRITE);
+}
+#endif
+
 #include <nvidia-dma-fence-helper.h>
 
 #if defined(NV_LINUX_DMA_RESV_H_PRESENT)
